home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / transport.h < prev    next >
C/C++ Source or Header  |  1991-06-04  |  2KB  |  67 lines

  1. /* @(#) $Header: transport.h,v 1.7 91/06/04 11:35:01 deyke Exp $ */
  2.  
  3. #ifndef _TRANSPORT_H
  4. #define _TRANSPORT_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _TIMER_H
  15. #include "timer.h"
  16. #endif
  17.  
  18. #define EOL_NONE        0       /* No EOL conversion (binary) */
  19. #define EOL_CR          1       /* EOL is "\r" */
  20. #define EOL_LF          2       /* EOL is "\n" */
  21. #define EOL_CRLF        3       /* EOL is "\r\n" */
  22.  
  23. struct transport_cb {
  24.   void *cp;                     /* Pointer to connection control block */
  25.   int (*recv) __ARGS((void *cp, struct mbuf **bpp, int cnt));
  26.                 /* Recv function */
  27.   int (*send) __ARGS((void *cp, struct mbuf *bp));
  28.                 /* Send function */
  29.   int (*send_space) __ARGS((void *cp));
  30.                 /* Send space function */
  31.   int (*close) __ARGS((void *cp));
  32.                 /* Close function */
  33.   int (*del) __ARGS((void *cp));
  34.                 /* Delete function */
  35.   void (*r_upcall) __ARGS((struct transport_cb *tp, int cnt));
  36.                 /* Called when data arrives */
  37.   void (*t_upcall) __ARGS((struct transport_cb *tp, int cnt));
  38.                 /* Called when ok to send more data */
  39.   void (*s_upcall) __ARGS((struct transport_cb *tp));
  40.                 /* Called when connection is terminated */
  41.   void *user;                   /* User parameter (e.g., for mapping to an
  42.                  * application control block
  43.                  */
  44.   struct timer timer;           /* No activity timer */
  45.   int  recv_mode;               /* Recv EOL mode */
  46.   int  recv_char;               /* Last char received */
  47.   int  send_mode;               /* Send EOL mode */
  48.   int  send_char;               /* Last char sent */
  49. };
  50.  
  51. /* In transport.c: */
  52. struct transport_cb *transport_open __ARGS((
  53.   char *protocol,
  54.   char *address,
  55.   void (*r_upcall) __ARGS((struct transport_cb *tp, int cnt)),
  56.   void (*t_upcall) __ARGS((struct transport_cb *tp, int cnt)),
  57.   void (*s_upcall) __ARGS((struct transport_cb *tp)),
  58.   void *user));
  59. int transport_recv __ARGS((struct transport_cb *tp, struct mbuf **bpp, int cnt));
  60. int transport_send __ARGS((struct transport_cb *tp, struct mbuf *bp));
  61. int transport_send_space __ARGS((struct transport_cb *tp));
  62. void transport_set_timeout __ARGS((struct transport_cb *tp, int timeout));
  63. int transport_close __ARGS((struct transport_cb *tp));
  64. int transport_del __ARGS((struct transport_cb *tp));
  65.  
  66. #endif  /* _TRANSPORT_H */
  67.